#!/bin/sh
# This regression test is a part of SIPp.
# Media is set up from an INVITE whose Content-Type is application/sdp in
# another case and with a parameter: "Application/SDP;charset=utf-8".
. "`dirname "$0"`/../functions"; init

uac_media_port=5392

udplisten $uac_media_port >udplisten.log &
udplisten_job=$!
trap "kill -9 $udplisten_job 2>/dev/null" EXIT

sippbg -sf uas.xml -i 127.0.0.1 -p 5390 -m 1
sippfg -m 1 -sf uac.xml 127.0.0.1:5390 -i 127.0.0.1 -p 5394 \
    -timeout 6 -timeout_error >/dev/null 2>&1
status=$?

test $status -ne 0 && fail "SIPp UAC job failed"

port=`sed -e '/^Connectionless from/!d;s/.*://' udplisten.log`
if test -n "$port"; then
    ok
else
    fail "got no RTP at all"
fi
